<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
    <c:set var="ctx" value="${pageContext.request.contextPath}" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>金融机构详情</title>
    <jsp:include page="../../import.jsp" flush="true" />
    <script language="javascript"  src="<%=path %>/resource/utils/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div id="pageInTab" class="pageInTab">
        <div tabid="tabA" title="基本信息" lselected="true">
            <form id="formSet1">
            	<div class="fieldset1 tabel_col clearFix">
					<div class="caption">
                        <span class="title">基本信息</span>
                    </div>
					<div class="fieldBox col_33">
						<div class="label">金融机构名称</div>
						<div class="field">
							<input name=""  value="${friVo.fundRasInsNm }" type="text" class="ui-textbox" readonly > 
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">统一社会信用代码<span class="requiredSymbol">*</span></div>
						<div class="field">
							<input name="uscc" id="uscc" type="text" value="${friVo.uscc }" class="ui-textbox" readonly validate="{required:true}">
							
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">注册时间<span class="requiredSymbol">*</span></div>
						<div class="field">
							<input name="regCapTm" id="regCapTm" type="text"  validate="{required:true}" readonly>
						</div>
					</div>
					<div class="fieldBox col_66">
						<div class="label">注册地址<span class="requiredSymbol">*</span></div>
						<div class="field">
							<input name="regAddr" id="regAddr" type="text" class="ui-textbox"  validate="{required:true}" value="${friVo.regAddr}" readonly>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">注册资金<span class="requiredSymbol">*</span></div>
						<div class="field">
							<input type="text" id="regCapAmt" name="regCapAmt" class="ui-textbox" value="${friVo.regCapAmt}" validate="{required:true,number:true}" readonly/>
						     <select name="regCapUntCd" id="regCapUntCd" ligerui="width: 60" data-value="${friVo.regCapUntCd}" readonly>
								<c:forEach items="${capUntCdList }" var="kv" begin="0" step="1" varStatus="status">
									<c:if test="${status.index == 0}">
								    	<option value="${kv.key }" checked >${kv.value }</option>
									</c:if>
								    <c:if test="${status.index != 0}">
								    	<option value="${kv.key }">${kv.value }</option>
								 	</c:if>
								</c:forEach>
							</select>
						</div>
					</div>
					<div class="fieldBox col_66_auto">
						<div class="label">区域<span class="requiredSymbol">*</span></div>
						<div class="field">
							<!-- <input name="rgnPrCd" id="rgnPrCd" type="text" class="ui-textbox" value=""> -->
							<jsp:include page="../../system/sysRegion/region.jsp"
										 flush="true">
								<jsp:param name="regionShowLvl" value="2" />
							</jsp:include>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">机构属性<span class="requiredSymbol">*</span></div>
						<div class="field">
							<select name="fundInsProp" id="fundInsProp" >
								<c:forEach items="${fundInsPropList }" var="propItem">
									<option value="${propItem.key }"  <c:if test="${friVo.fundInsProp== propItem.key }"> selected </c:if> >${propItem.value }</option>
								</c:forEach>
							</select>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">机构类型<span class="requiredSymbol">*</span></div>
						<div class="field">
							<select name="fundInsType" id="fundInsType" readonly="readonly" >
								<option value="">请选择</option>
								<c:forEach items="${fundInsTypeList}" var="typeItem">
									<option value="${typeItem.key }" disabled <c:if test="${friVo.fundInsType== typeItem.key }"> selected </c:if> >${typeItem.value }</option>
								</c:forEach>
							</select>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">合作时间<span class="requiredSymbol">*</span></div>
						<div class="field">
							<input name="coopTm" id="coopTm" type="text" readonly  validate="{required:true}"  >
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">融担公司企业编号</div>
						<div class="field">
							<input name="guaranteeCoopNum" id="guaranteeCoopNum" readonly type="text" class="ui-textbox"   value="${friVo.guaranteeCoopNum}">
						</div>
					</div>
					<div class="fieldBox col_100">
						<div class="label">备注</div>
						<div class="field" style="width: 100%;">
                        	<textarea name="remark" id="remark" rows="4"  readonly class="l-textarea" style="width:99%">${friVo.remark }</textarea>
						</div>
					</div>
				</div>
				<div class="sqPanel">
	                <div class="sqPanel_head inL">
	                    <div class="btnsBox inLC">
	                    </div>
	                    <span>主要人员信息</span>
	                </div>
	                <div class="sqPanel_body">
	                    <div id="ligergrid_A1" class="sq-grid"></div>
	                </div>
	            </div>
	            <div class="btnsBox">
                    <input name="friBaseId" id="friBaseId" type="hidden" value="${id }">
	            </div>
            </form>
        </div>
        <div tabid="tabB" title="备案资料">
            <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
        </div>
    </div>
</div>


<script type="text/javascript">
    var loadedTabs=[];
    var friRlPsnGrid;
    var friBaseId = '${id}';
    var isRlpsn = '${isRlpsn}';

    $(function(){
    	
        var formSet1  = $("#formSet1").ligerForm({
            validate : true
        });
        $("#formSet1").ligerForm();

        formSet1.setFieldValidate("rgnProvCd", {
            required: true,
            select: false
        });
    	formSet1.setFieldValidate("rgnCityCd", {
            required: true,
            select: false
        });
    	formSet1.setFieldValidate("fundInsType", {
            required: true,
            select: false
        });
        
        initTab();
        initFriBaseRlGrid();
        if(isRlpsn!=null && isRlpsn!='' && isRlpsn>0){
        }else{
        	addfriRlPsnFix();
        }
        var regCapTmStr='${friVo.regCapTmStr}';
        if(regCapTmStr !='' && null!= regCapTmStr && 'undefined' != regCapTmStr ){//初始化注册时间 
        	regCapTmStr = new Date(regCapTmStr);
             regCapTmStr = DateUtils.formatDate(regCapTmStr, DateUtils.YYYY_MM_DDHHMMSS);
             $("#regCapTm").val(regCapTmStr);
        }
        var coopTmStr='${friVo.coopTmStr}';
        if(coopTmStr !='' && null!= coopTmStr && 'undefined' != coopTmStr ){//初始化 合作时间
        	coopTmStr = new Date(coopTmStr);
            coopTmStr = DateUtils.formatDate(coopTmStr, DateUtils.YYYY_MM_DDHHMMSS);
            $("#coopTm").val(coopTmStr); 
        }
		//区域处理 rgnProvCd rgnCityCd rgnPrCd 
	    var rgnPrCd = '${friVo.rgnPrCd}';
	    var rgnCyCd = '${friVo.rgnCyCd}';
	    console.log("rgnPrCd"+rgnPrCd);
	    console.log("rgnCyCd"+rgnCyCd);
	    if(rgnPrCd !='' && null!= rgnPrCd && 'undefined' != rgnPrCd ){//初始化 区域 省
            setRgnProvCdUpdataValue(rgnPrCd);
        }
	    if(rgnCyCd !='' && null!= rgnCyCd && 'undefined' != rgnCyCd ){//初始化 区域 市
            setRgnCityCdUpdataValue(rgnCyCd);
        }
	    setRegionSelectDataChange();
        
	    liger.get("fundInsProp").setDisabled(true);
	    liger.get("fundInsType").setDisabled(true);
	    liger.get("regCapUntCd").setDisabled(true);
	    liger.get("rgnProvCd").setDisabled(true);
	    liger.get("rgnCityCd").setDisabled(true);
    })
    //设置页面数据
    function setData(data){
        var form = liger.get("formSet1");
		/* /* //区域数据处理
        setRgnProvCdUpdataValue(data.rgnPrCd);
        setRgnCityCdUpdataValue(data.rgnCyCd);
        setRegionSelectDataChange(); */
    };

    //初始化Tab页
    function initTab(){
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: 450,
            onBeforeSelectTabItem: function (tabid) {
                var _friBaseId = $("#friBaseId").val();
                if(tabid!="tabA"){
                    if(!_friBaseId){
                        top.$.ligerDialog.SQalert({content: "请确认金融机构基本信息已存在", SQ_type: "warning"});
                        return false;
                    }
                }
            },
            onAfterSelectTabItem: function(tabid) {
                if (loadedTabs.indexOf(tabid)<0) {
                    var _friBaseId = $("#friBaseId").val();
                    if(tabid!="tabA"){
                        if(!_friBaseId){
                            top.$.ligerDialog.SQalert({content: "请确认金融机构基本信息已存在", SQ_type: "warning"});
                            return false;
                        }
                    }
                    loadedTabs.push(tabid);
                    switch (tabid){
                     	case "tabB": //备案资料
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/rfbase/fribaseinfo/recordInfo.do?friId="+_friBaseId);                     		
                     	break;
                    }
                };
                SetIframe_height();
            }
        });
    };
    
  	//证件类型
    var certTypCdListJSON = [];
    <c:if test="${not empty certTypCdListJSON}"> certTypCdListJSON = ${certTypCdListJSON}; </c:if>

	//联系人类型
    var rlTypCDListJSON = [];
    <c:if test="${not empty rlTypCDListJSON}"> rlTypCDListJSON = ${rlTypCDListJSON}; </c:if>
 
    //联系人类型
    var mustAddRlPsnJSON = [];
    <c:if test="${not empty mustAddRlPsnTypCdJSON}">
    	mustAddRlPsnJSON = ${mustAddRlPsnTypCdJSON};
    	console.log("mustAddRlPsnJSON ==="+JSON.stringify(mustAddRlPsnJSON));
    </c:if>

	//初始化主要人员信息
    function initFriBaseRlGrid() {
    	var _friBaseId = $("#friBaseId").val();
        friRlPsnGrid = $("#ligergrid_A1").ligerGrid({
            url: '<%=path%>/rfbase/fribaseinfo/initRlPsnList.do?',
	    	method : 'get',
	    	parms:{"fund_id":_friBaseId},
	    	async: false,
	    	columns: [
					{ display: '联系人姓名(<span class="c_red">*</span>)', name: 'rlNm', width: 150, editor: {type: 'text'},
                        validate: function (value,rowData,col) {
                            if (StringUtils.isEmpty(value)) return "此项为必填项！";
                        },maxlength: 50, min:1     // 最大长度
					},
	  	            { display: '联系人类型(<span class="c_red">*</span>)', name: 'rlTypCd', width: 200,
						valueField: 'rlTypCd',
						textField: 'rlTypCdNm',
						render: function (item) {
							return item.rlTypCdNm;
						}
	  	            },
	  	           {display: '股比',name:'stockRatio',width:100},
	  	           { display: '证件类型(<span class="c_red">*</span>)', name: 'certTypCd', width: 140,
	                   	valueField: 'certTypCd',
	                   	textField: 'certTypCdNm',
	                   	render: function (item) {
	                   	    return item.certTypCdNm;
	                  	},
                        validate: function (value,rowData,col) {
                            if (StringUtils.isEmpty(value)) return "此项为必填项！";
                        }
	  	            },
	  	            { display: '证件号', name: 'certNo', width: 170, 
                        validate: function (value,rowData,col) {
                        },digits: true,maxlength: 20, min:15
                    },
	                { display: '联系电话(<span class="c_red">*</span>)', name: 'tel', width: 150, 
                        validate: function (value,rowData,col) {
                            if (StringUtils.isEmpty(value)) return "此项为必填项！";
                        },digits: true,maxlength: 20, min:8
					}],
	   	  	   usePager: false,
	           root: 'rows',
	           record: 'total',
	           hideLoadButton: true,
	           width: '100%',
	           height: 300,
	           heightDiff: -2,
			   enabledEdit: true,
	           isScroll: false,
	           checkbox: false,
	           rownumbers: true,
	           allowUnSelectRow: true,
	           alternatingRow: false,
	           enabledSort:false
	        });
	    };


</script>



</body>
</html>
